//获取韦恩图的数据
import { VennChartList } from '@/services/VennChart';
import { useEffect, useState } from 'react';

type VennChartData = {
  sets: string[];
  size: number;
  label: string;
  value: string;
};

const useVennChart = (): VennChartData[] => {
  const [vennChart, setvennChart] = useState<VennChartData[]>([]);
  useEffect(() => {
    const fetchData = async () => {
      try {
        const res = await VennChartList();
        if (res.success) {
          console.log('vennChartList:', res.data.VennChart);
          setvennChart(res.data.VennChart);
        }
      } catch (error) {
        console.error('Error fetching setvennChartList data:', error);
      }
    };

    fetchData();
  }, []);

  return vennChart;
};

export default useVennChart;
